package com.holmeslei.greendaodemo.database;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.holmeslei.greendaodemo.entity.Company;
import com.holmeslei.greendaodemo.entity.Employee;

import com.holmeslei.greendaodemo.database.CompanyDao;
import com.holmeslei.greendaodemo.database.EmployeeDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig companyDaoConfig;
    private final DaoConfig employeeDaoConfig;

    private final CompanyDao companyDao;
    private final EmployeeDao employeeDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        companyDaoConfig = daoConfigMap.get(CompanyDao.class).clone();
        companyDaoConfig.initIdentityScope(type);

        employeeDaoConfig = daoConfigMap.get(EmployeeDao.class).clone();
        employeeDaoConfig.initIdentityScope(type);

        companyDao = new CompanyDao(companyDaoConfig, this);
        employeeDao = new EmployeeDao(employeeDaoConfig, this);

        registerDao(Company.class, companyDao);
        registerDao(Employee.class, employeeDao);
    }
    
    public void clear() {
        companyDaoConfig.clearIdentityScope();
        employeeDaoConfig.clearIdentityScope();
    }

    public CompanyDao getCompanyDao() {
        return companyDao;
    }

    public EmployeeDao getEmployeeDao() {
        return employeeDao;
    }

}
